<!DOCTYPE html>
<html lang='zh'>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>题目浏览</title>
    <script>
        var pageNum = <?php echo $pageNum; ?>;
        var start = <?php echo $offset; ?>;
        var pageSize = <?php echo $limit; ?>;
        function preview() {
            if(pageNum<=1)return;
            pageNum = pageNum-1;
            start = (pageNum-1)*pageSize;
            document.getElementById('pageNum').value=pageNum;
            document.getElementById('offset').value=start;
            document.getElementById('limit').value=pageSize;
            document.getElementById('form1').submit();
        }

        function next() {
            pageNum = pageNum+1;
            var start = (pageNum-1)*pageSize;
            document.getElementById('pageNum').value=pageNum;
            document.getElementById('offset').value=start;
            document.getElementById('limit').value=pageSize;
            document.getElementById('form1').submit();
        }
    </script>
</head>
<body>
<form id="form1" method="post" action="/script/rplist/index">
    <input hidden id="pageNum" name="pageNum" value="1" />
    <input hidden id="offset"  name="offset" value="0" />
    <input hidden id="limit" name="limit" value="10" />
    <label>学段：</label>
    <select name="stage">
        <option <?php echo $stage=='xiaoxue'?'selected':''; ?> value="xiaoxue">小学</option>
        <option <?php echo $stage=='chuzhong'?'selected':''; ?> value="chuzhong">初中</option>
        <option <?php echo $stage=='gaozhong'?'selected':''; ?> value="gaozhong">高中</option>
    </select>&nbsp;&nbsp;&nbsp;&nbsp;
    <label>年级：</label>
    <select name="grade">
        <option value="">全部</option>
        <option <?php echo $grade=='x1'?'selected':''; ?> value="x1">一年级</option>
        <option <?php echo $grade=='x2'?'selected':''; ?> value="x2">二年级</option>
        <option <?php echo $grade=='x3'?'selected':''; ?> value="x3">三年级</option>
        <option <?php echo $grade=='x4'?'selected':''; ?> value="x4">四年级</option>
        <option <?php echo $grade=='x5'?'selected':''; ?> value="x5">五年级</option>
        <option <?php echo $grade=='x6'?'selected':''; ?> value="x6">六年级</option>
        <option <?php echo $grade=='c1'?'selected':''; ?> value="c1">七年级</option>
        <option <?php echo $grade=='c2'?'selected':''; ?> value="c2">八年级</option>
        <option <?php echo $grade=='c3'?'selected':''; ?> value="c3">九年级</option>
        <option <?php echo $grade=='g1'?'selected':''; ?> value="g1">高一</option>
        <option <?php echo $grade=='g2'?'selected':''; ?> value="g2">高二</option>
        <option <?php echo $grade=='g3'?'selected':''; ?> value="g3">高三</option>
    </select>&nbsp;&nbsp;&nbsp;&nbsp;
    <label>学科：</label>
    <select name="subject">
        <option value="">全部</option>
        <option <?php echo $subject=='yuwen'?'selected':''; ?> value="yuwen">语文</option>
        <option <?php echo $subject=='shuxue'?'selected':''; ?> value="shuxue">数学</option>
        <option <?php echo $subject=='yingyu'?'selected':''; ?> value="yingyu">英语</option>
        <option <?php echo $subject=='dili'?'selected':''; ?> value="dili">物理</option>
        <option <?php echo $subject=='huaxue'?'selected':''; ?> value="huaxue">化学</option>
        <option <?php echo $subject=='shengwu'?'selected':''; ?> value="shengwu">生物</option>
        <option <?php echo $subject=='dili'?'selected':''; ?> value="dili">地理</option>
        <option <?php echo $subject=='lishi'?'selected':''; ?> value="lishi">历史</option>
        <option <?php echo $subject=='zhengzhi'?'selected':''; ?> value="zhengzhi">政治</option>
    </select>&nbsp;&nbsp;&nbsp;&nbsp;
    <button style="width: 100px;" type="submit">搜索</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <button onclick="preview()">上一页</button>&nbsp;&nbsp;第<?php echo $pageNum; ?>页&nbsp;&nbsp;<button onclick="next()">下一页</button>

</form>
<hr><br>
<?php $idx=$offset+1; foreach ($list as $qt) { ?>
    <label style="color:#FF000C"><?php echo $idx++; ?>.</label>
<label>【<?php echo $qt->questionType; ?>】</label>&nbsp;&nbsp;&nbsp;&nbsp;
<label>难度：</label><?php echo $qt->difficulty; ?>&nbsp;&nbsp;&nbsp;&nbsp;
<label>年份：</label><?php echo $qt->createDate; ?>&nbsp;&nbsp;&nbsp;&nbsp;
    <label>ID：</label><?php echo $qt->id; ?>&nbsp;&nbsp;&nbsp;&nbsp;
    <br><br>
<?php echo $qt->questionTrunk; ?>
<br><label>答案：</label>
<?php echo $qt->answer; ?>
<br><label>解析：</label>
<?php echo $qt->analysis; ?>
    <br><hr><br>
<?php } ?>
<br>
<button onclick="preview()">上一页</button>&nbsp;&nbsp;第<?php echo $pageNum; ?>页&nbsp;&nbsp;<button onclick="next()">下一页</button>

</body>
</html>